package cn.admin.configcenter.registry.common.info;

import cn.admin.config.common.Revision;
import cn.admin.config.common.protocol.Swizzle;

import java.io.Serializable;
import java.util.Properties;

public class RevisedData implements Serializable {

    private final Serializable data;
    private final Revision revision;


    public RevisedData(Serializable data,Revision revision) {
        this.data = data;
        this.revision = revision;
    }

    public Serializable getData() {
        return this.data instanceof Swizzle ? this.data : new Swizzle(this.data);
    }

    public Serializable getExtractData() {
        return this.data;
    }

    public Revision getRevision() {
        return this.revision;
    }

    public static boolean isSupportDataType(Serializable data) {
        return data.getClass() == String.class || data.getClass() == Properties.class;
    }

}
